<template> 
	<div id="page">
			<div   v-html="dataHtml"></div>
			<Comment v-if="isShow"></Comment>
	</div>
</template>
<script>
   import Comment from './../components/Comment'
	export default {

	data(){
		return {
			dataHtml: '',
			isShow:false
		}
	},
    
	created(){
		var _self=this;
		this.api.articleDetail(_self.$route.params.id).then(res => {   
               _self.$store.commit('changeIndexConf', {
                isToast: false,
                isHeader:true,
                isFooter:false,
                 title:{
                    "name":res.data.title
                }
             })
            
	  		_self.dataHtml = res.data.content;
	  		_self.getActicleState();
            }).catch(function(error) {
                console.log(error);
            });
		
	},

	methods:{
	  getActicleState:function(){
	  	var _self=this;
         var params={
              author:_self.args().id,
              acticle:_self.$route.params.id
         }
         if (params.author==""|params.acticle=="") return;
		  this.api.acticleState(params).then(res => {   
           
               _self.$store.commit('changecomments', {
                  article: _self.$route.params.id,
                  critics: _self.args().id,
                  isCollect: res.data[0].collect,
                  isthumb_up: res.data[0].love,
                  isthumb_down: res.data[0].unlike

             })
            _self.isShow=true;
           
            }).catch(function(error) {
                console.log(error);
            });
	  }
	},
	components: {
		Comment
	}
}
</script>
<style lang="scss" scoped>
   @import "../../static/css/detail.scss"; 
</style>